import os

count = 0
def writeFile(l):
	global count
	print count
	l = l.replace('\n', '')
	print len(l)

	fn = "files/"+str(count)+".bin"
	if os.path.exists(fn):
		os.system('rm -rf %s' % (fn))
	f = open(fn, "wb")
	p = l.decode("hex")
	f.write(p)
	f.close()
	print "pngF", count
	count += 1


con = open("testlog.txt", "r").readlines()
for l in con:
	if len(l) > 100:
		writeFile(l)
	#elif count >= 2:
	#	break

print "All", count


